<template>
	<view>
		<view class="main">
			<scroll-view scroll-y="true" class="box" show-scrollbar="false">
				<view class="item">
					<view class="img">
						<image src="../../static/10001.jpg" mode=""></image>
					</view>
					<view class="info">
						<view class="info-tex">
							<text class="tex1">Air Jordan 2 Retro Low复刻男子运动鞋</text>
							<text class="tex2">1914人付款</text>
							<text class="tex3">￥589.00</text>
						</view>
						<view class="tb">
							<view class="sc">
								<image src="../../static/font/shouc.png" mode=""></image>
							</view>
							<view class="cart">
								<image src="../../static/font/cart.png" mode=""></image>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			// 检测用户是否登录了
			IsLogin(){
				const that = this
				uni.getStorage({
					key:'isLogin',
					//获取状态
					success(res) {
						if(res.data == false){ // 表示用户没有登录
							that.$notify({ type: 'warning', message: '请先登录,三秒后跳到登录页面' });
							let second = 3
							const timer = setInterval(()=>{
								second--
								if(!second){
									clearInterval(timer)
									uni.navigateTo({
										url:'/pages/login/login'
									})	
								}
							},1000)
						}
					},
					// 获取本地数据失败,用户可能是第一次登录
					fail() {
					that.$notify({ type: 'warning', message: '请先登录,三秒后跳到登录页面' });
					let second = 3
					const timer = setInterval(()=>{
						second--
						if(!second){
							clearInterval(timer)
							uni.navigateTo({
								url:'/pages/login/login'
							})	
						}
					},1000)
				}
				})
			}
		},
		onShow() {
			this.IsLogin()
		}
	}
</script>

<style lang="less">
	.box{
		white-space: nowrap;
		height: 1000rpx;
	}
.main{
	width: 100%;
	height: 89.5vh;
	background: #f3f3f3;
		.item{
			margin-top: 20rpx;
			margin-left: 35rpx;
			width: 90%;
			height: 200rpx;
			border-radius: 20rpx;
			background: white;
			display: flex;
			align-items: center;
			justify-content: space-around;
			.img image{
				width: 220rpx;
				height: 180rpx;
				border-radius: 10px;
			}
			.info{
				width:63%;
				height: 100%;
				display: flex;
				justify-content: space-between;
			.info-tex{
				width: 75%;
				height: 100%;
				padding: 10rpx 0;
				
				display: flex;
				flex-direction: column;
				.tex1{
					height: 40px;
					font-size: 26rpx;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow-y: hidden;
				}
				.tex2{
					margin: 10rpx 0;
					height: 40rpx;
					font-size: 24rpx;
					color: #949494;
				}
			}
			.tb{
				width: 20%;
				height: 100%;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				.sc,.cart{
					width: 35px;
					height: 35px;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 50%;
					border: 1px solid #c7c700;
					image{
						width: 20px;
						height: 20px;
					}
				}
				.cart{
					border: 0;
					background-color: #085710;
				}
			}
			}
		}
	
}
</style>
